package com.zjd.dao;

import com.zjd.domain.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface UserDao {
    @Select("SELECT * FROM tab_user WHERE username = #{username} AND `password` = #{password}")
    User login(User user);

    @Insert("INSERT INTO `travel`.`tab_user`(`uid`,`username`,`password`,`telephone`,`nickname`,`sex`,`birthday`,`email`,`pic`)" +
            " VALUES ( NULL,#{username},#{password},#{telephone},NULL,NULL,NULL,NULL,NULL)")
    void saveUser(User user);

    @Update("UPDATE `tab_user` SET `nickname`=#{nickname},`sex`=#{sex},`birthday`=#{birthday},`email`=#{email} WHERE `uid`=#{uid}")
    void updateUser(User user);
}
